HOMEDIR = ./

#SUB_DIR = ./src/exception/ ./src/time/ ./src/log/ ./src/interface ./src/file/ ./src/string/ ./src/conf/ ./src/old_conf/ ./src/radix/ ./src/net/ ./src/mmap/ ./src/thread/ ./src/dict/ ./src/sign/ ./src/base64/ ./src/index/
SUB_DIR = ./src/common ./test/common ./src/exception ./src/time ./src/log/ ./src/conf/  
INC_DIR = ./include/
LIB_DIR = ./lib/

include ./Rules.make

all :
	@if [ ! -d $(INC_DIR) ]; then \
	mkdir $(INC_DIR); \
	fi ; \
	if [ ! -d $(LIB_DIR) ]; then \
	mkdir $(LIB_DIR); \
	fi ; \
	for dir in $(SUB_DIR); do \
	$(MAKE) -C $$dir -f Makefile; \
	if [ $$? -eq 0 ] ; then \
	echo -e "\033[34;1mMAKE IN $$dir OK. \n\033[m"; \
	else \
	echo -e "\033[31;1mWHEN MAKE IN $$dir ERROR OCCUR.\033[m"; \
	break; \
	fi \
	done

clean :
	@if [ -d $(INC_DIR) ]; then \
	rm -rf $(INC_DIR); \
	fi ; \
	if [ -d $(LIB_DIR) ]; then \
	rm -rf $(LIB_DIR); \
	fi ; \
	for dir in $(SUB_DIR); do \
	$(MAKE) -C $$dir -f Makefile clean; \
	if [ $$? -eq 0 ] ; then \
	echo -e "\033[34;1mMAKE CLEAN IN $$dir OK. \n\033[m"; \
	else \
	echo -e "\033[31;1mWHEN MAKE CLEAN IN $$dir ERROR OCCUR.\033[m"; \
	break; \
	fi \
	done

install : all
	@for dir in $(SUB_DIR); do \
	$(MAKE) -C $$dir -f Makefile install; \
	if [ $$? -eq 0 ] ; then \
	echo -e "\033[34;1mMAKE INSTALL IN $$dir OK. \n\033[m"; \
	else \
	echo -e "\033[31;1mWHEN MAKE INSTALL IN $$dir ERROR OCCUR.\033[m"; \
	break; \
	fi \
	done

